Skip to content

Comments

Remove redundant existence check before DELETE in sqlite_sequence#39

Merged
babakjahan merged 2 commits intoimprovement/1028from
copilot/sub-pr-36-another-one
Nov 5, 2025
Merged

Remove redundant existence check before DELETE in sqlite_sequence#39
babakjahan merged 2 commits intoimprovement/1028from
copilot/sub-pr-36-another-one

Conversation

Copy link

Copilot AI commented Nov 4, 2025

Addresses review feedback on #36 regarding unnecessary complexity in database cleanup logic.

Changes

  • Removed redundant SELECT query that checked if each table exists in sqlite_sequence before attempting DELETE
  • Simplified control flow by eliminating conditional check around DELETE operation
  • Updated comment to clarify that DELETE succeeds regardless of row existence

Before

sequence_exists = await session.execute(
    text("SELECT name FROM sqlite_sequence WHERE name=:table_name"), {"table_name": table_name}
)
if sequence_exists.fetchone():
    await session.execute(
        text("DELETE FROM sqlite_sequence WHERE name=:table_name"), {"table_name": table_name}
    )

After

await session.execute(
    text("DELETE FROM sqlite_sequence WHERE name=:table_name"), {"table_name": table_name}
)

SQL DELETE operations are idempotent and succeed whether or not the target row exists, making the existence check purely overhead.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI mentioned this pull request Nov 4, 2025
@babakjahan babakjahan marked this pull request as ready for review November 4, 2025 23:55
@babakjahan babakjahan requested a review from Copilot November 4, 2025 23:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@babakjahan babakjahan requested a review from Copilot November 4, 2025 23:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: babakjahan <5642363+babakjahan@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP Address feedback from review on PR #36 Remove redundant existence check before DELETE in sqlite_sequence Nov 5, 2025
Copilot AI requested a review from babakjahan November 5, 2025 00:00
Copy link
Contributor

@babakjahan babakjahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@babakjahan babakjahan merged commit 0a11604 into improvement/1028 Nov 5, 2025
@babakjahan babakjahan deleted the copilot/sub-pr-36-another-one branch November 23, 2025 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants